from pydantic import BaseModel
from typing import Optional
from datetime import datetime

class KnowledgeBaseBase(BaseModel):
    name: str
    description: Optional[str] = None
    settings: Optional[str] = None

class KnowledgeBaseCreate(KnowledgeBaseBase):
    pass

class KnowledgeBaseUpdate(BaseModel):
    name: Optional[str] = None
    description: Optional[str] = None
    settings: Optional[str] = None
    is_active: Optional[bool] = None

class KnowledgeBaseResponse(KnowledgeBaseBase):
    id: int
    user_id: int
    is_active: bool
    created_at: datetime
    updated_at: Optional[datetime] = None
    
    class Config:
        from_attributes = True